/***********************************************************************
 * POJO Class :  SysResource.java
 * Author:  Bill Vison
 * Purpose: Defines the Class SysResource
 ***********************************************************************/

package org.vsg.security.model.domain;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;

@javax.persistence.Entity
@javax.persistence.Table(name = "sys_resource")
@Inheritance(strategy=InheritanceType.JOINED)
public class SysResource implements java.io.Serializable,java.lang.Cloneable {


	@Column(name ="id")
	@Id
	@GeneratedValue(strategy = javax.persistence.GenerationType.IDENTITY)			
	private long id;
	 
	
	private String code;
	 
	
	private String name;
	 
	
	private String description;
	 
	@Column(name ="FLAG_DELETED")
	private short flagDeleted;
	 
	@OneToMany(
		mappedBy="resource",
		cascade = {CascadeType.ALL},
		fetch = FetchType.LAZY)	
	private Set<ResourceAssociation> permissions;
	
	@Column(name ="flag_type")
	protected short flagType;

	
	/**
	 * @param newId
	 */	
	public void setId(long newId) {
		id = newId;
	}
	
	public long getId() {
		return id;
	}	
	
	/**
	 * @param newCode
	 */	
	public void setCode(String newCode) {
		code = newCode;
	}
	
	public String getCode() {
		return code;
	}	
	
	/**
	 * @param newName
	 */	
	public void setName(String newName) {
		name = newName;
	}
	
	public String getName() {
		return name;
	}	
	
	/**
	 * @param newDescription
	 */	
	public void setDescription(String newDescription) {
		description = newDescription;
	}
	
	public String getDescription() {
		return description;
	}	
	
	/**
	 * @param newFlagDeleted
	 */	
	public void setFlagDeleted(short newFlagDeleted) {
		flagDeleted = newFlagDeleted;
	}
	
	public short getFlagDeleted() {
		return flagDeleted;
	}	
	
	/**
	 * @param newPermissions
	 */	
	public void setPermissions(Set<ResourceAssociation> newPermissions) {
		permissions = newPermissions;
	}
	
	public Set<ResourceAssociation> getPermissions() {
		return permissions;
	}

	public short getFlagType() {
		return flagType;
	}

	public void setFlagType(short flagType) {
		this.flagType = flagType;
	}	

	
	
}